import { getToken, removeToken, setToken } from "@/utils/storage";

const user = {
  namespaced: true,
  state: {
    token: getToken(),
  },
  mutations: {
    updateToken(state, newToken) {
      setToken(newToken);
      state.token = newToken;
    },
    delToken(state) {
      removeToken();
      state.token = null;
    },
  },
};

export default user;
